<template>
  <div>
    <el-dialog v-model="dialogVisible" :close-on-click-modal="false">
      <template #header>
        <div>修改备注</div>
      </template>
      <el-form label-width="auto" :model="remarksForm">
        <el-form-item label="年龄" prop="age">
          <el-select placeholder="请选择年龄" v-model="remarksForm.age">
            <el-option
              v-for="item in ageOptions"
              :key="item.age"
              :label="item.label"
              :value="item.label"
            >
              <span>{{ item.label }}</span>
              <span style="margin: 0px 10px">/</span>
              <span>{{ item.value }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="男女">
          <el-select placeholder="请选择男女" v-model="remarksForm.genderZ">
            <el-option
              v-for="(item, index) in GenderList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="邮编">
          <el-input
            placeholder="请输入邮编"
            v-model="remarksForm.postcode"
          ></el-input>
        </el-form-item>
        <el-form-item label="地区">
          <el-input
            placeholder="请输入地区"
            v-model="remarksForm.address"
          ></el-input>
        </el-form-item>
        <el-form-item label="全职">
          <el-select
            placeholder="请选择全职"
            v-model="remarksForm.occupationStatusZ"
          >
            <el-option
              v-for="(item, index) in JobList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="学历">
          <el-select placeholder="请选择学历" v-model="remarksForm.educationZ">
            <el-option
              v-for="(item, index) in EducationalQualifications"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="公司人数">
          <el-select
            placeholder="请选择公司人数"
            v-model="remarksForm.companyPeopleNumber"
          >
            <el-option
              v-for="(item, index) in CompanyHeadcountList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="公司收入" v-model="remarksForm">
          <el-select
            placeholder="请选择公司收入"
            v-model="remarksForm.companyIncomeZ"
          >
            <el-option
              v-for="(item, index) in CompanyRevenueList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="个人收入">
          <el-select
            placeholder="请选择个人收入"
            v-model="remarksForm.personageIncomeZ"
          >
            <el-option
              v-for="(item, index) in CompanyRevenueList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="行业">
          <el-select placeholder="请选择行业" v-model="remarksForm.industryZ">
            <el-option
              v-for="(item, index) in IndustryList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="人种">
          <el-select placeholder="请选择人种" v-model="remarksForm.raceZ">
            <el-option
              v-for="(item, index) in RaceList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="语言">
          <el-select placeholder="请选择语言" v-model="remarksForm.languageZ">
            <el-option
              v-for="(item, index) in LanguageList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="职位级别">
          <el-select
            placeholder="请选择职位级别"
            v-model="remarksForm.positionLevelZ"
          >
            <el-option
              v-for="(item, index) in JobLevelList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="子女">
          <el-select placeholder="请选择子女" v-model="remarksForm.childrenNum">
            <el-option
              v-for="(item, index) in ListOfChildren"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="您的家庭目前年税收入">
          <el-select
            placeholder="请选择您的家庭目前年税收入"
            v-model="remarksForm.familyYearIncomeZ"
          >
            <el-option
              v-for="(item, index) in AnnualFamilyTaxIncomeList"
              :key="index"
              :value="item.value"
            >
              <span>{{ item.label }}</span>
              <span style="margin-left: 20px">{{ item.label1 }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="备注1">
          <el-input
            placeholder="请输入备注"
            v-model="remarksForm.remark01"
          ></el-input>
        </el-form-item>
        <el-form-item label="备注2">
          <el-input
            placeholder="请输入备注"
            v-model="remarksForm.remark02"
          ></el-input>
        </el-form-item>
        <el-form-item label="备注3">
          <el-input
            placeholder="请输入备注"
            v-model="remarksForm.remark03"
          ></el-input>
        </el-form-item>
      </el-form>
      <template #footer>
        <div>
          <el-button type="primary" @click="submitForm">确认</el-button>
          <el-button @click="dialogVisible = false">关闭</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { ref, reactive, onMounted } from "vue";
import { ElMessage } from "element-plus";
import {
  listSurveyLog,
  getSurveyLog,
  delSurveyLog,
  addSurveyLog,
  updateSurveyLog,
  listSurveyLogByid,
} from "@/api/survey/surveyLog";
let dialogVisible = ref(false);
const ageOptions = ref([]);
const GenderList = ref([
  {
    label: "男",
    label1: "Male",
    value: "男",
    valueE: "Male",
  },
  {
    label: "女",
    label1: "Female",
    value: "女",
    valueE: "Female",
  },
  {
    label: "双性/模棱两可",
    label1: "Intersex/ambiguous",
    value: "双性/模棱两可",
    valueE: "Intersex/ambiguous",
  },
  {
    label: "不愿意透露",
    label1: "Not willing to disclose",
    value: "不愿意透露",
    valueE: "Not willing to disclose",
  },
]);
const JobList = ref([
  {
    label: "全职雇佣",
    label1: "Employed full-time",
    value: "全职雇佣",
    valueE: "Employed full-time",
  },
  {
    label: "兼职雇佣",
    label1: "Employed part-time",
    value: "兼职雇佣",
    valueE: "Employed part-time",
  },
  {
    label: "全职自雇",
    label1: "Self-employed full-time",
    value: "全职自雇",
    valueE: "Self-employed full-time",
  },
  {
    label: "兼职自雇",
    label1: "Self-employed part-time",
    value: "兼职自雇",
    valueE: "Self-employed part-time",
  },
  {
    label: "现役军人",
    label1: "Active military",
    value: "现役军人",
    valueE: "Active military",
  },
  {
    label: "非现役军人/退伍军人",
    label1: "Inactive military/Veteran",
    value: "非现役军人/退伍军人",
    valueE: "Inactive military/Veteran",
  },
  {
    label: "临时失业",
    label1: "Temporarily unemployed",
    value: "临时失业",
    valueE: "Temporarily unemployed",
  },
  {
    label: "全职家庭主妇",
    label1: "Full-time homemaker",
    value: "全职家庭主妇",
    valueE: "Full-time homemaker",
  },
  {
    label: "退休",
    label1: "Retired",
    value: "退休",
    valueE: "Retired",
  },
  {
    label: "学生",
    label1: "Student",
    value: "学生",
    valueE: "Student",
  },
  {
    label: "残疾",
    label1: "Disabled",
    value: "残疾",
    valueE: "Disabled",
  },
  {
    label: "不愿回答",
    label1: "Prefer not to answer",
    value: "不愿回答",
    valueE: "Prefer not to answer",
  },
  {
    label: "产假",
    label1: "Parental leave",
    value: "产假",
    valueE: "Parental leave",
  },
  {
    label: "休假",
    label1: "Leave of absence",
    value: "休假",
    valueE: "Leave of absence",
  },
  {
    label: "无法工作",
    label1: "Unable to work",
    value: "无法工作",
    valueE: "Unable to work",
  },
  {
    label: "其他有偿工作",
    label1: "Other type of paid work",
    value: "其他有偿工作",
    valueE: "Other type of paid work",
  },
  {
    label: "抚养家庭",
    label1: "Bringing up a family",
    value: "抚养家庭",
    valueE: "Bringing up a family",
  },
  {
    label: "无偿全职护理",
    label1: "Unpaid full-time carer",
    value: "无偿全职护理",
    valueE: "Unpaid full-time carer",
  },
  {
    label: "无偿工作",
    label1: "Working unpaid",
    value: "无偿工作",
    valueE: "Working unpaid",
  },
  {
    label: "在找工作",
    label1: "In-between jobs / looking for work",
    value: "在找工作",
    valueE: "In-between jobs / looking for work",
  },
  {
    label: "追求自我目标",
    label1: "Pursuing own goals",
    value: "追求自我目标",
    valueE: "Pursuing own goals",
  },
]);
const EducationalQualifications = ref([
  {
    label: "低于O级/GCSE",
    label1: "Below O-level/ GCSE",
    value: "低于O级/GCSE",
    valueE: "Below O-level/ GCSE",
  },
  {
    label: "O级/GCSE",
    label1: "O-levels / GCSEs",
    value: "O级/GCSE",
    valueE: "O-levels / GCSEs",
  },
  {
    label: "O级/GCSE同等学历",
    label1: "O-levels / GCSEs equivalent",
    value: "O级/GCSE同等学历",
    valueE: "O-levels / GCSEs equivalent",
  },
  {
    label: "A级",
    label1: "A-levels",
    value: "A级",
    valueE: "A-levels",
  },
  {
    label: "A级同等学历",
    label1: "A-levels equivalent",
    value: "A级同等学历",
    valueE: "A-levels equivalent",
  },
  {
    label: "本科（少于2年）",
    label1: "Undergraduate degree (less than 2 years)",
    value: "本科（少于2年）",
    valueE: "Undergraduate degree (less than 2 years)",
  },
  {
    label: "本科（3年）",
    label1: "Undergraduate degree (3 years)",
    value: "本科（3年）",
    valueE: "Undergraduate degree (3 years)",
  },
  {
    label: "本科（4年或以上）",
    label1: "Undergraduate degree (4 or more years)",
    value: "本科（4年或以上）",
    valueE: "Undergraduate degree (4 or more years)",
  },
  {
    label: "研究生：其他（非博士或硕士）",
    label1: "Post graduate: other (not PhD or MA)",
    value: "研究生：其他（非博士或硕士）",
    valueE: "Post graduate: other (not PhD or MA)",
  },
  {
    label: "研究生：硕士",
    label1: "Post graduate: MA",
    value: "研究生：硕士",
    valueE: "Post graduate: MA",
  },
  {
    label: "研究生：博士",
    label1: "Post graduate: PhD",
    value: "研究生：博士",
    valueE: "Post graduate: PhD",
  },
  {
    label: "以上皆无/不愿回答",
    label1: "None of the above/Prefer not to say",
    value: "以上皆无/不愿回答",
    valueE: "None of the above/Prefer not to say",
  },
  {
    label: "其他",
    label1: "Other",
    value: "其他",
    valueE: "Other",
  },
]);
const CompanyHeadcountList = ref([
  {
    label: "0-20",
    value: "0-20",
  },
  {
    label: "20-50",
    value: "20-50",
  },
  {
    label: "50-100",
    value: "50-100",
  },
  {
    label: "100-200",
    value: "100-200",
  },
  {
    label: "200-500",
    value: "200-500",
  },
  {
    label: "500-999",
    value: "500-999",
  },
  {
    label: "1,000-1,499",
    value: "1,000-1,499",
  },
  {
    label: "1,500-1,999",
    value: "1,500-1,999",
  },
  {
    label: "2,000-2,499",
    value: "2,000-2,499",
  },
  {
    label: "2,500-4,999",
    value: "2,500-4,999",
  },
  {
    label: "5,000-9,999",
    value: "5,000-9,999",
  },
  {
    label: "10,000-29,999",
    value: "10,000-29,999",
  },
  {
    label: "30,000-49,999",
    value: "30,000-49,999",
  },
  {
    label: "50,000",
    value: "50,000",
  },
]);
const CompanyRevenueList = ref([
  {
    label: "低于$249,999",
    label1: "Under $249,999",
    value: "低于$249,999",
    valueE: "Under $249,999",
  },
  {
    label: "$250,000-$499,999",
    label1: "$250,000-$499,999",
    value: "$250,000-$499,999",
    valueE: "$250,000-$499,999",
  },
  {
    label: "$500,000-$999,999",
    label1: "$500,000-$999,999",
    value: "$500,000-$999,999",
    valueE: "$500,000-$999,999",
  },
  {
    label: "$1百万-$2.49百万",
    label1: "$1 million-$2.49 million",
    value: "$1百万-$2.49百万",
    valueE: "$1 million-$2.49 million",
  },
  {
    label: "$2.5百万-$4.9百万",
    label1: "$2.5 million - $4.9 million",
    value: "$2.5百万-$4.9百万",
    valueE: "$2.5 million - $4.9 million",
  },
  {
    label: "$5百万-$9.9百万",
    label1: "$5 million - $9.9 million",
    value: "$5百万-$9.9百万",
    valueE: "$5 million - $9.9 million",
  },
  {
    label: "$10百万-$24.9百万",
    label1: "$10 million - $24.9 million",
    value: "$10百万-$24.9百万",
    valueE: "$10 million - $24.9 million",
  },
  {
    label: "$25百万-$74.9百万",
    label1: "$25 million - $74.9 million",
    value: "$25百万-$74.9百万",
    valueE: "$25 million - $74.9 million",
  },
  {
    label: "$75百万-$199.9百万",
    label1: "$75 million - $199.9 million",
    value: "$75百万-$199.9百万",
    valueE: "$75 million - $199.9 million",
  },
  {
    label: "$200百万-$999.9百万",
    label1: "$200 Million - $999.9 Million",
    value: "$200百万-$999.9百万",
    valueE: "$200 Million - $999.9 Million",
  },
  {
    label: "$1十亿以上",
    label1: "$1 billion +",
    value: "$1十亿以上",
    valueE: "$1 billion +",
  },
  {
    label: "不愿回答",
    label1: "Prefer not to answer",
    value: "不愿回答",
    valueE: "Prefer not to answer",
  },
]);
const IndustryList = ref([
  { label: "会计", label1: "Accounting", value: "会计", valueE: "Accounting" },
  {
    label: "广告",
    label1: "Advertising",
    value: "广告",
    valueE: "Advertising",
  },
  {
    label: "农业/渔业",
    label1: "Agriculture/Fishing",
    value: "农业/渔业",
    valueE: "Agriculture/Fishing",
  },
  {
    label: "建筑",
    label1: "Architecture",
    value: "建筑",
    valueE: "Architecture",
  },
  { label: "汽车", label1: "Automotive", value: "汽车", valueE: "Automotive" },
  { label: "航空", label1: "Aviation", value: "航空", valueE: "Aviation" },
  {
    label: "银行/金融",
    label1: "Banking/Financial",
    value: "银行/金融",
    valueE: "Banking/Financial",
  },
  {
    label: "生物技术",
    label1: "Bio-Tech",
    value: "生物技术",
    valueE: "Bio-Tech",
  },
  { label: "经纪", label1: "Brokerage", value: "经纪", valueE: "Brokerage" },
  {
    label: "木工/电气安装/管道",
    label1: "Carpentry/Electrical installations/VVS",
    value: "木工/电气安装/管道",
    valueE: "Carpentry/Electrical installations/VVS",
  },
  {
    label: "化工/塑料/橡胶",
    label1: "Chemicals/Plastics/Rubber",
    value: "化工/塑料/橡胶",
    valueE: "Chemicals/Plastics/Rubber",
  },
  {
    label: "通信/信息",
    label1: "Communications/Information",
    value: "通信/信息",
    valueE: "Communications/Information",
  },
  {
    label: "计算机硬件",
    label1: "Computer Hardware",
    value: "计算机硬件",
    valueE: "Computer Hardware",
  },
  {
    label: "计算机经销商（软件/硬件）",
    label1: "Computer Reseller (software/hardware)",
    value: "计算机经销商（软件/硬件）",
    valueE: "Computer Reseller (software/hardware)",
  },
  {
    label: "计算机软件",
    label1: "Computer Software",
    value: "计算机软件",
    valueE: "Computer Software",
  },
  {
    label: "建筑施工",
    label1: "Construction",
    value: "建筑施工",
    valueE: "Construction",
  },
  { label: "咨询", label1: "Consulting", value: "咨询", valueE: "Consulting" },
  {
    label: "消费电子",
    label1: "Consumer Electronics",
    value: "消费电子",
    valueE: "Consumer Electronics",
  },
  {
    label: "消费包装品",
    label1: "Consumer Packaged Goods",
    value: "消费包装品",
    valueE: "Consumer Packaged Goods",
  },
  { label: "教育", label1: "Education", value: "教育", valueE: "Education" },
  {
    label: "能源/公用事业/石油和天然气",
    label1: "Energy/Utilities/oil and Gas",
    value: "能源/公用事业/石油和天然气",
    valueE: "Energy/Utilities/oil and Gas",
  },
  {
    label: "工程",
    label1: "Engineering",
    value: "工程",
    valueE: "Engineering",
  },
  {
    label: "环境服务",
    label1: "Environmental Services",
    value: "环境服务",
    valueE: "Environmental Services",
  },
  {
    label: "时尚/服装",
    label1: "Fashion/Apparel",
    value: "时尚/服装",
    valueE: "Fashion/Apparel",
  },
  {
    label: "食品/饮料",
    label1: "Food/Beverage",
    value: "食品/饮料",
    valueE: "Food/Beverage",
  },
  {
    label: "政府/公共部门",
    label1: "Government/Public sector",
    value: "政府/公共部门",
    valueE: "Government/Public sector",
  },
  {
    label: "医疗保健",
    label1: "Healthcare",
    value: "医疗保健",
    valueE: "Healthcare",
  },
  {
    label: "酒店/旅游",
    label1: "Hospitality/Tourism",
    value: "酒店/旅游",
    valueE: "Hospitality/Tourism",
  },
  {
    label: "人力资源",
    label1: "Human Resources",
    value: "人力资源",
    valueE: "Human Resources",
  },
  {
    label: "信息技术/IT",
    label1: "Information Technology/IT",
    value: "信息技术/IT",
    valueE: "Information Technology/IT",
  },
  { label: "保险", label1: "Insurance", value: "保险", valueE: "Insurance" },
  { label: "互联网", label1: "Internet", value: "互联网", valueE: "Internet" },
  {
    label: "法律/法务",
    label1: "Legal/Law",
    value: "法律/法务",
    valueE: "Legal/Law",
  },
  {
    label: "制造业",
    label1: "Manufacturing",
    value: "制造业",
    valueE: "Manufacturing",
  },
  {
    label: "市场研究",
    label1: "Market Research",
    value: "市场研究",
    valueE: "Market Research",
  },
  {
    label: "市场营销",
    label1: "Marketing",
    value: "市场营销",
    valueE: "Marketing",
  },
  {
    label: "媒体/娱乐",
    label1: "Media/Entertainment",
    value: "媒体/娱乐",
    valueE: "Media/Entertainment",
  },
  {
    label: "非营利/社会服务",
    label1: "Non Profit/Social services",
    value: "非营利/社会服务",
    valueE: "Non Profit/Social services",
  },
  { label: "军队", label1: "Military", value: "军队", valueE: "Military" },
  {
    label: "个人服务",
    label1: "Personal Services",
    value: "个人服务",
    valueE: "Personal Services",
  },
  {
    label: "制药",
    label1: "Pharmaceuticals",
    value: "制药",
    valueE: "Pharmaceuticals",
  },
  {
    label: "印刷出版",
    label1: "Printing Publishing",
    value: "印刷出版",
    valueE: "Printing Publishing",
  },
  {
    label: "公共关系",
    label1: "Public Relations",
    value: "公共关系",
    valueE: "Public Relations",
  },
  {
    label: "房地产/物业",
    label1: "Real Estate/Property",
    value: "房地产/物业",
    valueE: "Real Estate/Property",
  },
  {
    label: "零售/批发贸易",
    label1: "Retail/wholesale trade",
    value: "零售/批发贸易",
    valueE: "Retail/wholesale trade",
  },
  { label: "安保", label1: "Security", value: "安保", valueE: "Security" },
  {
    label: "航运/配送",
    label1: "Shipping/Distribution",
    value: "航运/配送",
    valueE: "Shipping/Distribution",
  },
  {
    label: "电信",
    label1: "Telecommunications",
    value: "电信",
    valueE: "Telecommunications",
  },
  {
    label: "运输",
    label1: "Transportation",
    value: "运输",
    valueE: "Transportation",
  },
  { label: "销售", label1: "Sales", value: "销售", valueE: "Sales" },
  {
    label: "电话销售/呼叫中心",
    label1: "Telemarketing/ Call Center",
    value: "电话销售/呼叫中心",
    valueE: "Telemarketing/ Call Center",
  },
  {
    label: "商业服务",
    label1: "Business Services",
    value: "商业服务",
    valueE: "Business Services",
  },
  {
    label: "物理和社会科学",
    label1: "Physical and Social Sciences",
    value: "物理和社会科学",
    valueE: "Physical and Social Sciences",
  },
  {
    label: "熟练工",
    label1: "Skilled Trades",
    value: "熟练工",
    valueE: "Skilled Trades",
  },
  { label: "采矿", label1: "Mining", value: "采矿", valueE: "Mining" },
  {
    label: "我不工作",
    label1: "I don't work",
    value: "我不工作",
    valueE: "I don't work",
  },
  { label: "其他", label1: "Other", value: "其他", valueE: "Other" },
]);
const RaceList = ref([
  { label: "阿拉伯人", label1: "Arab", value: "阿拉伯人", valueE: "Arab" },
  { label: "亚洲人", label1: "Asian", value: "亚洲人", valueE: "Asian" },
  { label: "黑人", label1: "Black", value: "黑人", valueE: "Black" },
  {
    label: "西班牙裔",
    label1: "Hispanic",
    value: "西班牙裔",
    valueE: "Hispanic",
  },
  { label: "拉丁裔", label1: "Latino", value: "拉丁裔", valueE: "Latino" },
  { label: "白人", label1: "White", value: "白人", valueE: "White" },
  {
    label: "多种族",
    label1: "Multiracial",
    value: "多种族",
    valueE: "Multiracial",
  },
  { label: "其他", label1: "Other", value: "其他", valueE: "Other" },
  {
    label: "不愿透露",
    label1: "Prefer not to say",
    value: "不愿透露",
    valueE: "Prefer not to say",
  },
]);
const LanguageList = ref([
  {
    label: "罗马尼亚语",
    label1: "rommÃnä",
    value: "罗马尼亚语",
    valueE: "rommÃnä",
  },
  { label: "英语", label1: "English", value: "英语", valueE: "English" },
  { label: "法语", label1: "frangais", value: "法语", valueE: "frangais" },
  {
    label: "西班牙语",
    label1: "español",
    value: "西班牙语",
    valueE: "español",
  },
  { label: "匈牙利语", label1: "magyar", value: "匈牙利语", valueE: "magyar" },
  { label: "德语", label1: "Deutsch", value: "德语", valueE: "Deutsch" },
  { label: "土耳其语", label1: "Turkge", value: "土耳其语", valueE: "Turkge" },
  {
    label: "保加利亚语",
    label1: "бьлгарски",
    value: "保加利亚语",
    valueE: "бьлгарски",
  },
  { label: "希腊语", label1: "EAAnVLKá", value: "希腊语", valueE: "EAAnVLKá" },
  { label: "波兰语", label1: "polski", value: "波兰语", valueE: "polski" },
]);
const JobLevelList = ref([
  {
    label: "所有者或合伙人",
    label1: "Owner or Partner",
    value: "所有者或合伙人",
    valueE: "Owner or Partner",
  },
  {
    label: "总裁/首席执行官/董事长",
    label1: "President/CE0 /Chairperson",
    value: "总裁/首席执行官/董事长",
    valueE: "President/CE0 /Chairperson",
  },
  {
    label: "C级高管",
    label1: "C level executive",
    value: "C级高管",
    valueE: "C level executive",
  },
  {
    label: "中层管理",
    label1: "Middle Management",
    value: "中层管理",
    valueE: "Middle Management",
  },
  {
    label: "首席财务官",
    label1: "CFO",
    value: "首席财务官",
    valueE: "CFO",
  },
  {
    label: "首席技术官",
    label1: "CTO",
    value: "首席技术官",
    valueE: "CTO",
  },
  {
    label: "高级管理",
    label1: "Senior Management",
    value: "高级管理",
    valueE: "Senior Management",
  },
  {
    label: "董事",
    label1: "Director",
    value: "董事",
    valueE: "Director",
  },
  {
    label: "人力资源经理",
    label1: "HR Manager",
    value: "人力资源经理",
    valueE: "HR Manager",
  },
  {
    label: "产品经理",
    label1: "Product Manager",
    value: "产品经理",
    valueE: "Product Manager",
  },
  {
    label: "供应经理",
    label1: "Supply Manager",
    value: "供应经理",
    valueE: "Supply Manager",
  },
  {
    label: "销售经理",
    label1: "Sales Manager",
    value: "销售经理",
    valueE: "Sales Manager",
  },
  {
    label: "项目管理",
    label1: "Project Management",
    value: "项目管理",
    valueE: "Project Management",
  },
]);
const ListOfChildren = ref([
  {
    label: "0",
    value: "0",
  },
  {
    label: "1",
    value: "1",
  },
  {
    label: "2",
    value: "2",
  },
  {
    label: "3",
    value: "3",
  },
  {
    label: "4",
    value: "4",
  },
  {
    label: "5",
    value: "5",
  },
  {
    label: "6",
    value: "6",
  },
  {
    label: "7",
    value: "7",
  },
  {
    label: "8",
    value: "8",
  },
  {
    label: "9",
    value: "9",
  },
  {
    label: "10",
    value: "10",
  },
]);
const AnnualFamilyTaxIncomeList = ref([
  {
    label: "少于25,000美元",
    label1: "Moins de 25 000$",
    value: "少于25,000美元",
    valueE: "Moins de 25 000$",
  },
  {
    label: "25到39,000美元",
    label1: "25 À 39 000$",
    value: "25到39,000美元",
    valueE: "25 À 39 000$",
  },
  {
    label: "40到49,000美元",
    label1: "40 À 49 000$",
    value: "40到49,000美元",
    valueE: "40 À 49 000$",
  },
  {
    label: "50到59,000美元",
    label1: "50 À 59 000$",
    value: "50到59,000美元",
    valueE: "50 À 59 000$",
  },
  {
    label: "60到74,000美元",
    label1: "60 À 74 000$",
    value: "60到74,000美元",
    valueE: "60 À 74 000$",
  },
  {
    label: "75到99,000美元",
    label1: "75 Ã 99 000 DOLLARS",
    value: "75到99,000美元",
    valueE: "75 Ã 99 000 DOLLARS",
  },
  {
    label: "100到149,000美元",
    label1: "100 À 149 000$",
    value: "100到149,000美元",
    valueE: "100 À 149 000$",
  },
  {
    label: "150到199,000美元",
    label1: "150 À 199 000$",
    value: "150到199,000美元",
    valueE: "150 À 199 000$",
  },
  {
    label: "200到249,000美元",
    label1: "200 À 249 000 DOLLARS",
    value: "200到249,000美元",
    valueE: "200 À 249 000 DOLLARS",
  },
  {
    label: "250到299,000美元",
    label1: "250 À 299 000 DOLLARS",
    value: "250到299,000美元",
    valueE: "250 À 299 000 DOLLARS",
  },
  {
    label: "300到499,000美元",
    label1: "300 Ã 499 000 DOLLARS",
    value: "300到499,000美元",
    valueE: "300 Ã 499 000 DOLLARS",
  },
  {
    label: "500,000美元或以上",
    label1: "500 000$ ou plus",
    value: "500,000美元或以上",
    valueE: "500 000$ ou plus",
  },
]);

/**
 * 构建添加的备注表单
 */
const remarksForm = ref({
  age: null,
  genderZ: null,
  genderE: null,
  postcode: null,
  address: null,
  occupationStatusZ: null,
  occupationStatusE: null,
  educationZ: null,
  educationE: null,
  companyPeopleNumber: null,
  companyIncomeZ: null,
  companyIncomeE: null,
  personageIncomeZ: null,
  personageIncomeE: null,
  industryZ: null,
  industryE: null,
  raceZ: null,
  raceE: null,
  languageZ: null,
  languageE: null,
  positionLevelZ: null,
  positionLevelE: null,
  childrenNum: null,
  familyYearIncomeZ: null,
  familyYearIncomeE: null,
  remark01: null,
  remark02: null,
  remark03: null,
});
const saveId = ref(0);
const openDialog = async (id) => {
  /**
   * 打开弹出框时，调取详情接口
   */
  let res = await getSurveyLog(id);
  saveId.value = res.data.id;
  console.log(res, "res");
  fetchData(res.data);
  dialogVisible.value = true;
};
const generateAgeOptions = () => {
  const currentYear = new Date().getFullYear();
  const minAge = 18;
  const maxAge = 70;
  for (let age = minAge; age <= maxAge; age++) {
    ageOptions.value.push({
      label: age === minAge ? `${age}-` : age === maxAge ? `${age}+` : age,
      value: currentYear - age,
    });
  }
  console.log(ageOptions.value, "ageOptions");
};

/**
 * 数据回显方法
 */
const fetchData = (data) => {
  for (let key in data) {
    if (data.hasOwnProperty(key) && remarksForm.value.hasOwnProperty(key)) {
      remarksForm.value[key] = data[key];
    }
  }
};

/**
 * 快速查找英文方法
 */

const mapToEnglish = (data, list, keyZ, keyE) => {
  const item = list.find((i) => i.label === data[keyZ]);
  if (item) {
    data[keyE] = item.valueE;
  }
};
/**
 * 提交备注表单
 */
const submitForm = async () => {
  const data = remarksForm.value;
  mapToEnglish(data, GenderList.value, "genderZ", "genderE");
  mapToEnglish(data, JobList.value, "occupationStatusZ", "occupationStatusE");
  mapToEnglish(
    data,
    EducationalQualifications.value,
    "educationZ",
    "educationE"
  );
  mapToEnglish(
    data,
    CompanyRevenueList.value,
    "companyIncomeZ",
    "companyIncomeE"
  );
  mapToEnglish(
    data,
    CompanyRevenueList.value,
    "personageIncomeZ",
    "personageIncomeE"
  );
  mapToEnglish(data, IndustryList.value, "industryZ", "industryE");
  mapToEnglish(data, RaceList.value, "raceZ", "raceE");
  mapToEnglish(data, LanguageList.value, "languageZ", "languageE");
  mapToEnglish(data, JobLevelList.value, "positionLevelZ", "positionLevelE");
  mapToEnglish(
    data,
    AnnualFamilyTaxIncomeList.value,
    "familyYearIncomeZ",
    "familyYearIncomeE"
  );
  data.id = saveId.value;
  let res = await updateSurveyLog(data);
  console.log(res, "res");
  if (res.code == 200) {
    ElMessage.success("修改成功");
    dialogVisible.value = false;
  }
};
onMounted(() => {
  generateAgeOptions();
});
defineExpose({
  openDialog,
});
</script>
<style lang="scss" scoped>
:deep(.el-select) {
  width: 100%;
}
</style>
